package top.huxy.boot.controller.admin;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.huxy.boot.annotation.Master;
import top.huxy.boot.annotation.Operation;
import top.huxy.boot.model.dto.DTO_ADDArticle;
import top.huxy.boot.model.dto.DTO_UpdateArticle;
import top.huxy.boot.service.ArticleService;
import top.huxy.boot.util.obj.Result;

@RequestMapping("/admin/article")
@RestController
public class AdminArticleController {
    @Autowired
    ArticleService articleService;

    @PostMapping("/addArticle")
    @Master
    @Operation("发布文章")
    public Result addArticle(DTO_ADDArticle article) {
        Integer id=articleService.addArticle(article);
        return Result.success(id);
    }

    @PostMapping("/updateArticle")
    @Master
    @Operation("发布文章")
    public Result updateArticle(DTO_UpdateArticle article) {
        articleService.updateArticle(article);
        return Result.success("修改成功");
    }
}
